package com.qindian.coupontest;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;

import java.util.List;

/**
 * Author: Li
 * Date: 2018/5/21 0021
 * Description:
 */

public class PackageUtil {
    public static boolean checkPackage(Context context,String packageName) {
        PackageManager manager = context.getPackageManager();
        List<PackageInfo> packages = manager.getInstalledPackages(0);
        for (PackageInfo info : packages) {
            if (info.packageName.equals(packageName)) {
                return true;
            }
        }
        return false;
    }
}
